package com.xuecheng.manage_course.controller;

import com.xuecheng.api.course.CourseViewControllerApi;
import com.xuecheng.framework.domain.course.ext.CourseView;
import com.xuecheng.framework.domain.course.response.CoursePublishResult;
import com.xuecheng.manage_course.service.CourseViewService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;


@RestController
@RequestMapping("/course/courseview")
public class CourseViewController implements CourseViewControllerApi {
    @Resource
    CourseViewService courseViewService;
    /**
     * 门户课程页详细信息查询,包括课程信息,课程图片,营销计划,课程计划
     * @param id 课程id
     * @return 封装好的实体类
     */
    @Override
    @GetMapping("/{id}")
    public CourseView getCourseView(@PathVariable("id") String id) {
        return courseViewService.getCourseView(id);
    }

    /**
     * 课程预览接口
     *
     * @param id 课程id
     * @return 远程调用cmd获取到的课程预览url
     */
    @Override
    @PostMapping("/{id}")
    public CoursePublishResult preview(@PathVariable String id) {
        return courseViewService.preview(id);
    }
}
